import React from 'react';
import {Button, Form} from 'antd'
import {ButtonComp, SwitchComp, GlobalProvider} from 'jh-lib';

export default class Test extends React.Component {
    state = {
        visible: false
    };

    formRef = React.createRef();

    render() {
        return <>
            <Button onClick={() => {
                this.formRef.current.resetFields();
            }}>resetForm</Button>
            <Button onClick={() => {
                this.formRef.current.setFieldsValue({});
            }}>setFormEmpty</Button>
            <Button onClick={() => {
                console.log('this.formRef.current.getFieldsValue()', this.formRef.current.getFieldsValue())
            }}>getFormData</Button>
            <Form ref={this.formRef}>
                <SwitchComp checkedChildren="开" unCheckedChildren="关" defaultChecked/>
                <br/>
                <Form.Item label={'标签描述'} name={'f1'} style={{marginBottom: 0}}>
                    <SwitchComp checkedChildren="1" unCheckedChildren="0"/>
                </Form.Item>
                <SwitchComp
                    compLabel={'compLabel1'}
                    fieldName={'fieldName1'}
                />
            </Form>
        </>;
    }
}
